<script setup>
import { ref } from 'vue'
const showPop = ref(false)
const emits = defineEmits(['closeQxxx'])
const tab = [
  { label: '温度', value: '16℃' },
  { label: '气压', value: '1001hPa' },
  { label: '温度', value: '35%' },
  { label: '降水', value: '100mm/h' },
  { label: '云高', value: '2km' },
  { label: '风速', value: '60m/s' },
  { label: '风向', value: '东北风' },
  { label: '能见度', value: '550m' },
  { label: '闪电距离', value: '30km' },
  { label: '告警信息', value: '风速超过起降安全阈值' },
  { label: '时间', value: '2025-02-26  15:43:56' }
]
const close = () => {
  showPop.value = false
  emits('closeQxxx')
}
const show = () => {
  showPop.value = true
}
defineExpose({
  show,
  close
})
</script>
<template>
  <!-- <transition
    appear
    name="custom-classes-transition"
    enter-active-class="animate__animated  animate__fadeIn"
    leave-active-class="animate__animated animate__faster  animate__fadeOut"
  >
    <div class="qxxx" v-drag v-if="showPop">
      <p class="title">
        <span>气象信息</span>
        <span @click="close"><img src="@img/pop/close_icon.png" alt="" /></span>
      </p>
      <div class="content">
        <div class="tab">
          <div v-for="(v, index) in tab" :key="index" class="tab_item">
            <span>{{ v.label }}</span> :
            <span :class="index === tab.length - 2 ? 'red' : ''">{{ v.value }}</span>
          </div>
        </div>
      </div>
    </div>
  </transition> -->
  <transition
    appear
    name="custom-classes-transition"
    enter-active-class="animate__animated  animate__fadeIn"
    leave-active-class="animate__animated animate__faster  animate__fadeOut"
  >
    <div
      class="qxxx"
      v-drag
      v-if="showPop"
    >
      <p class="title">
        <span>气象信息</span>
        <span @click="close"><img src="@img/pop/close_icon.png" alt="" /></span>
      </p>
      <div class="content">
        <p v-for="(v,index) in tab" :key="index" class="tab_item" :class="['tab_item',(v.label=='告警信息'||v.label=='时间')?'big':'']"><span>· <i>{{ v.label }}</i> :</span><span>{{ v.value }}</span></p>
      </div>
    </div>
  </transition>
</template>
<style scoped lang="scss">
.qxxx {
  position: fixed;
  z-index: 9;
  top: 200px;
  width: 400px;
  left: 30%;
  // margin-left:-450px;
  padding-bottom: 10px;
  background: url('@img/pop/airspace_bg.png');
  background-size: 100% 100%;

  .title {
    display: flex;
    padding: 20px 20px 10px 50px;
    align-items: center;
    font-size: 16px;
    justify-content: space-between;

    span:last-child {
      width: 18px;
      height: 18px;
      cursor: pointer;

      img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .content {
    margin-top: 5px;
    padding: 12px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;

    p {
      padding: 5px 0;
      display: flex;
      align-items: center;
      flex:0 0 180px;

      &.big{
        flex: 0 0 100%;
      }

      span:first-child {
        flex: 0 0 80px;
        color: #afebff;
        display: flex;
        align-items: center;
        margin-right: 10px;
        i {
          display: inline-block;
          width: 100%;
          margin: 0 3px;
          text-align-last: justify;
          text-align: justify;
          font-style: normal;
        }
      }

      span:last-child {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      &.name {
        font-size: 14px;
      }
    }
  }
}
</style>
